<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Random color example — event handler attribute</title>
    <style>
      button {
        margin: 10px
      };
    </style>
  </head>
  <body>
    <button onclick="bgChange()">Change color</button>
    <script>
      function random(number) {
        return Math.floor(Math.random()*number);
      }

      function bgChange() {
        const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')';
        document.body.style.backgroundColor = rndCol;
      }
    </script>
  </body>
</html>
